import request from '@/config/axios'
import type { TableData } from './types'
import {AdvertDemo} from "./types";

export const getTableListApi = (params: any): Promise<IResponse> => {
    return request.get({ url: '/example/list', params })
}

export const saveTableApi = (params: any): Promise<IResponse> => {
    return request.post({ url: '', params })
}
export const SelCommentInfo = (params: any): Promise<IResponse> => {
    return request.post({ url: '', params })
}
export const getCourseCommentList = (params: any): Promise<IResponse> => {
    return request.get({ url: 'http://localhost:8081/SyOperationController/selComment', params })
}
export const historyTodayCount = (params: any): Promise<IResponse> => {
    return request.post({ url: 'http://localhost:8081/SyOperationController/historyTodayCount', params })
}
export const updsaveTableApi = (params: any): Promise<IResponse> => {
    return request.post({ url: 'http://localhost:8081/SyOperationController/updComment', params })
}
//优惠卷
export const getListApi = (params: any): Promise<IResponse> => {
    return request.get({ url: 'http://localhost:8081/SyOperationController/selCoupon', params })
}
//编辑优惠卷的状态
//优惠卷
export const updCouponOnline = (coupon_id: number, online: string): Promise<IResponse> => {
    return request.get({ url: 'http://localhost:8081/SyOperationController/updCouponOnline', coupon_id, online })
}
//查看用户优惠卷
export const getcouponApi = (params: any) => {
    return request.get({ url: 'http://localhost:8081/SyOperationController/selCouponUsed', params })
}
//添加用户优惠卷
export const getAddcoupom = (params: any) => {
    return request.get({ url: 'http://localhost:8081/SyOperationController/addCoupon',params })
}
//删除用户优惠卷
export const getDelcoupom = (couponId: any) => {
    return request.get({ url: 'http://localhost:8081/SyOperationController/delCoupon',params: { couponId } })
}
//赠送优惠卷
export const getAddCouponUsed = (data: any) => {
    return request.post({ url: 'http://localhost:8081/SyOperationController/addCouponUsed',data})
}
//轮播图列表
export const getViewApi = (params: any) => {
    return request.get({ url: 'http://localhost:8081/SyOperationController/selCarouselPictures', params })
}
//添加轮播图
export const getAddViewApi = (params: any) => {
    return request.get({ url: 'http://localhost:8081/SyOperationController/addCarousel', params })
}
//编辑轮播图
export const getEditViewApi = (params: Partial<AdvertDemo>): Promise<IResponse<IResponse>> => {
    return request.post({ url: 'http://localhost:8081/SyOperationController/updCarousel', params })
}
//删除轮播图
export const getDelViewApi = (carousel_id: any) => {
    return request.get({ url: 'http://localhost:8081/SyOperationController/DeleteCarousel', params:{carousel_id} })
}

export const getTableDetApi = (id: string): Promise<IResponse<TableData>> => {
    return request.get({ url: '/example/detail', params: { id } })
}


export const delTableListApi = (id: string[] | number[]): Promise<IResponse> => {
    return request.post({ url: 'http://localhost:8081/SyOperationController/clearComment', data: { id } })
}

export const getMicroreviewTabList = (params: any): Promise<IResponse> => {
    return request.post({ url: 'http://localhost:8081/SyOperationController/selEssayComment', params })
}

export const getMicroreviewTabListCount = (params: any): Promise<IResponse> => {
    return request.post({ url: 'http://localhost:8081/SyOperationController/selCommentCount', params })
}

